﻿<UserControl x:Class="SqlMiM.Common.UserControls.PerfGraph.HistoryGraph"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:c="clr-namespace:SqlMiM.Common.UserControls.PerfGraph" 
        xmlns:d="clr-namespace:SqlMiM.Common.Converters"
        Name="_historyGraph"
        MinWidth="100" MinHeight="100">
    
    <Grid>
        <Grid.Resources>
            
            <BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
            <d:BrushOpacityConverter x:Key="brushOpacityConverter" />


            <Style x:Key="{x:Type c:GraphTimeline}" TargetType="{x:Type c:GraphTimeline}">
                <Setter Property="Foreground" Value="{Binding ElementName=_historyGraph, Path=Foreground}" />
                <Setter Property="Fill" Value="{Binding ElementName=_historyGraph, Path=Background, 
                    ConverterParameter=0.5, Converter={StaticResource brushOpacityConverter}}" />
                <Setter Property="FontSize" Value="10" />
                <Setter Property="Focusable" Value="false" />
            </Style>
        </Grid.Resources>
        <Border>
            <Border.Background>
                <ImageBrush x:Name="_renderBrush" ViewboxUnits="Absolute" >
                    <ImageBrush.RelativeTransform>
                        <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="-1" ScaleY="-1" />
                    </ImageBrush.RelativeTransform>
                </ImageBrush>
            </Border.Background>
        </Border>
        <!--<c:GraphTimeline x:Name="_graphScroll" Orientation="Horizontal" ShowHashLabels="false" 
                         NumPointsVisible="{Binding ElementName=_historyGraph, Path=VisibleInterval.TotalSeconds}" 
                         MajorHashInterval="{Binding ElementName=_historyGraph, Path=ScrollInterval.Seconds}" 
                         Foreground="{Binding ElementName=_historyGraph, Path=ScrollBrush}" 
                         Visibility="{Binding ElementName=_historyGraph, Path=IsRunning, Converter={StaticResource booleanToVisibilityConverter}}" />-->

        <c:GraphTimeline x:Name="_yAxisTimeline" Orientation="Vertical" HorizontalAlignment="Right" Width="8" 
                         NumPointsVisible="{Binding ElementName=_historyGraph, Path=YMaxValue}" 
                         MajorHashInterval="{Binding ElementName=_historyGraph, Path=MajorValueInterval}" 
                         MinorHashInterval="{Binding ElementName=_historyGraph, Path=MinorValueInterval}" 
                         HashLabelConverter="{Binding ElementName=_historyGraph, Path=VerticalAxisConverter}" />

        <!--<c:GraphTimeline x:Name="_yAxisTimeline" Orientation="Vertical" HorizontalAlignment="Right" Width="8" 
                         NumPointsVisible="30" 
                         MajorHashInterval="5" 
                         MinorHashInterval="1" 
                         HashLabelConverter="{Binding ElementName=_historyGraph, Path=VerticalAxisConverter}" />-->

        <c:GraphTimeline x:Name="_xAxisTimeline" Orientation="Horizontal" VerticalAlignment="Bottom" Height="8" 
                         NumPointsVisible="{Binding ElementName=_historyGraph, Path=VisibleInterval.TotalSeconds}" 
                         FirstPointVisible="{Binding ElementName=_historyGraph, Path=FirstTimeVisible.TotalSeconds}" 
                         MajorHashInterval="{Binding ElementName=_historyGraph, Path=MajorTimeInterval.Seconds}" 
                         MinorHashInterval="{Binding ElementName=_historyGraph, Path=MinorTimeInterval.Seconds}" />
    
    </Grid>
</UserControl>
